home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / BBS / MUBBS / MUBBS etc.cpt / Module Source / Module std routines / MUBBS Misc.c < prev    next >
Text File  |  1991-11-08  |  4KB  |  169 lines

  1. /*
  2.  *  MUBBS misc.c
  3.  *
  4.  *    This program source code and it's compiled version is
  5.  *  Copyright (c) 1991 N. Hawthorn.
  6.  *  This program source code and it's compiled version IS NOT IN THE
  7.  *  PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NH" file for details
  8.  *  regarding use of this program source code and it's compiled version.
  9.  *
  10.  *
  11.  * Code to make your life eaiser !
  12.  *
  13.  */
  14.  
  15. #define INMUBBSMISC
  16.  
  17. #include "MUBBS Module.h"
  18.  
  19.  
  20.  
  21. /* these are all the routines that you can call, some of them are to */
  22. /* be used carefully. See the accompanying documentation before use ! */
  23. /* Don't worry about the "godoit" stuff here, just see the examples   */
  24.  
  25.  
  26. send()        { ProcPtr hh; G->S=0; godoit; }
  27. print()        { ProcPtr hh; G->S=1; godoit; }
  28. sendtext()    { ProcPtr hh; G->S=2; godoit; }
  29. wait()        { ProcPtr hh; G->S=3; godoit; }
  30. cmd1()        { ProcPtr hh; G->S=4; godoit; }
  31. cmd1noecho(){ ProcPtr hh; G->S=5; godoit; }
  32. sendnc()    { ProcPtr hh; G->S=6; godoit; }
  33. showline()    { ProcPtr hh; G->S=7; godoit; }
  34. clock()        { ProcPtr hh; G->S=8; godoit; }
  35. portsin()    { ProcPtr hh; G->S=9; godoit; }
  36. passportsin(){ ProcPtr hh; G->S=10; godoit; }
  37. module()    { ProcPtr hh; G->S=11; godoit; }
  38. gettime()    { ProcPtr hh; G->S=12; godoit; }
  39. switchuser(){ ProcPtr hh; G->S=13; godoit; }
  40.  
  41. fopen()        { ProcPtr hh; G->S=14; godoit; }
  42. fclose()    { ProcPtr hh; G->S=15; godoit; }
  43. fread()        { ProcPtr hh; G->S=16; godoit; }
  44. fwrite()    { ProcPtr hh; G->S=17; godoit; }
  45. ftell()        { ProcPtr hh; G->S=18; godoit; }
  46. fsetpos()    { ProcPtr hh; G->S=19; godoit; }
  47. fgetpos()    { ProcPtr hh; G->S=20; godoit; }
  48. fseek()        { ProcPtr hh; G->S=21; godoit; }
  49. freopen()    { ProcPtr hh; G->S=22; godoit; }
  50. fputs()        { ProcPtr hh; G->S=23; godoit; }
  51. fputc()        { ProcPtr hh; G->S=24; godoit; }
  52. fgetc()        { ProcPtr hh; G->S=25; godoit; }
  53. fgets()        { ProcPtr hh; G->S=26; godoit; }
  54. fflush()    { ProcPtr hh; G->S=27; godoit; }
  55. fprintf()    { ProcPtr hh; G->S=28; godoit; }
  56. fscanf()    { ProcPtr hh; G->S=29; godoit; }
  57. clearerr()    { ProcPtr hh; G->S=30; godoit; }
  58. scanf()        { ProcPtr hh; G->S=31; godoit; }
  59. sscanf()    { ProcPtr hh; G->S=32; godoit; }
  60. sprintf()    { ProcPtr hh; G->S=33; godoit; }
  61. rewind()    { ProcPtr hh; G->S=34; godoit; }
  62. rename()    { ProcPtr hh; G->S=35; godoit; }
  63. remove()    { ProcPtr hh; G->S=36; godoit; }
  64. ungetc()    { ProcPtr hh; G->S=37; godoit; }
  65. puts()        { ProcPtr hh; G->S=38; godoit; }
  66. perror()    { ProcPtr hh; G->S=39; godoit; }
  67. otheruser()    { ProcPtr hh; G->S=40; godoit; }
  68. mackey()    { ProcPtr hh; G->S=41; godoit; }
  69. loguser()    { ProcPtr hh; G->S=42; godoit; }
  70. printout()    { ProcPtr hh; G->S=43; godoit; }
  71. versionck()    { ProcPtr hh; G->S=44; godoit; }
  72.  
  73.  
  74.  
  75. /* These two routines change string formats from C to Pascal and back
  76.  
  77. PtoCstr(tstring); where are these located ?? in C or Mac ????
  78. CtoPstr(tstring); this one returns a pointer ??
  79.  
  80. */
  81.  
  82. /* You can use these routines to switch things around if you want, they are */
  83. /* already written for you ! */
  84.  
  85.  
  86. removespaces(temp)
  87. char *temp;
  88. {
  89. int len;
  90. len = strlen(temp) - 1; /* takes out trailing spaces */
  91. while ((temp[len] == '\x20') && (len > 0)){
  92.     temp[len] = '\0';
  93.     len--;
  94.     }
  95. }
  96.  
  97. pStrCopy( p2, p1 )
  98. char *p2, *p1;
  99. /* copies a pascal string from p1 to p2 */
  100. {
  101.     int len;
  102.     
  103.     len = *p2++ = *p1++;
  104.     while (--len>=0) *p2++=*p1++;
  105. }
  106.  
  107.  
  108. strtoupper(str1) /* makes a string all uppercase */
  109. char *str1;
  110. {
  111. int i = 0,l;
  112. l=strlen(str1);
  113. do {
  114.     str1[i] = toupper(str1[i]);
  115.     } while (++i < l);
  116. }
  117.  
  118.  
  119. long strcatc(str,c) /* appends a character to a string */
  120. char *str,c;
  121. {
  122. char n[2];
  123. n[0]=c;
  124. n[1]=0;
  125.     strcat(str,n) ;
  126. }
  127. /*    end of function        */
  128.  
  129. long strtolong(str)
  130. char *str;
  131.     {
  132. long n;
  133.     sscanf(str,"%ld",&n) ;
  134.     return(n);
  135.     }
  136. /*    end of function        */
  137.  
  138. longtostr(n,str)
  139. char *str;
  140. long n;
  141.     {
  142.     sprintf(str,"%ld",n) ;
  143.     }
  144. /*    end of function        */
  145.  
  146. strtoint(str)
  147. char *str;
  148.     {
  149. int n=0;
  150.     sscanf(str,"%d",&n) ;
  151.     return(n);
  152.     }
  153. /*    end of function        */
  154.  
  155. inttostr(n,str)
  156. char *str;
  157. int n;
  158.     {
  159.     sprintf(str,"%d",n) ;
  160.     }
  161. /*    end of function        */
  162.  
  163. getdatetime(datetime)
  164. char *datetime;
  165. {
  166. gettime("%m/%d/%y %I:%M:%S %p",datetime); /* gets the date & time */
  167. }
  168.  
  169.